﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Csla.Server.Hosts;
using Csla.Server.Hosts.WcfChannel;

using Microsoft.SharePoint.Administration;

namespace SPaDevToolkit.Administration
{
    public abstract class SPaCslaWebServiceApplicationProxy : SPaWebServiceApplicationProxy<IWcfPortal>
    {
        #region Constructors
        public SPaCslaWebServiceApplicationProxy()
        {
        }

        public SPaCslaWebServiceApplicationProxy(string name, SPIisWebServiceProxy serviceProxy, Uri serviceEndpointUri)
            : base(name, serviceProxy, serviceEndpointUri)
        {
        }
        #endregion

       #region Overrides
        protected override string ClientConfigurationPath
        {
            get { return @"WebClients\Csla"; }
        }
        #endregion

        #region IWcfPortal
        public WcfResponse Create(CreateRequest request)
        {
            return Execute<WcfResponse>("Create", p => p.Create(request));
        }

        public WcfResponse Delete(DeleteRequest request)
        {
            return Execute<WcfResponse>("Delete", p => p.Delete(request));
        }

        public WcfResponse Fetch(FetchRequest request)
        {
            return Execute<WcfResponse>("Fetch", p => p.Fetch(request));
        }

        public WcfResponse Update(UpdateRequest request)
        {
            return Execute<WcfResponse>("Update", p => p.Update(request));
        }
        #endregion
    }
}
